package com.holly.unit.gen.api.util;

import cn.hutool.core.util.StrUtil;
import com.holly.unit.gen.api.constants.DbConstants;

/**
 * 类描述:
 *
 * @author fxr
 * @version 1.0.0
 * @date 2022/1/14 13:55
 */
public class TableUtil {

    /***
     * 返回字段是否为空属性
     * @param nullAble
     * @return
     */
    public static String getNullAble(String nullAble) {
        if ("YES".equals(nullAble) || "yes".equals(nullAble) ||
                "y".equals(nullAble) || "Y".equals(nullAble) || "f".equals(nullAble)) {
            return DbConstants.FIELD_NULL_Y;
        }

        if ("NO".equals(nullAble) || "no".equals(nullAble) ||
                "N".equals(nullAble) || "n".equals(nullAble) || "t".equals(nullAble)) {
            return DbConstants.FIELD_NULL_N;
        }
        return null;
    }

    /***
     * 返回字段是否为空属性
     * @param nullAble
     * @return
     */
    public static String getNullStr(String nullAble) {
        if (StrUtil.isBlank(nullAble)) {
            return "";
        } else {
            return nullAble;
        }
    }

    /***
     * 参数添加单引号
     * @param str
     * @return
     */
    public static String appendSingleQuote(String str) {
        return "'"+str+"'";
    }



}
